package com.lengxf.redis.redisson;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class RedissonConfig {

    @Bean
    public RedissonClient redisson() {
        Config config = new Config();
        //单机模式配置
        config.useSingleServer()
                .setAddress("redis://127.0.0.1:6379")
                .setDatabase(15);
//        config.useClusterServers(); 集群模式配置
        return Redisson.create(config);
    }

}
